package com.example.demo;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * @author yishuangshuang
 * @ClassName: RegexPhoneNum
 * @Description: TODO
 * @date 2019/1/25 9:35 AM
 */
public class RegexPhoneNum {
    public static void main(String args []) {
        String str = "13913954321";
        String pattern = "0?(13|14|15|18)[0-9]{9}";

        Pattern r = Pattern.compile(pattern);
        Matcher m = r.matcher(str);
        System.out.println(m.matches());
    }
}
